package com.zhkj.framework.utils;

import com.zhkj.framework.result.ResultVO;
import com.zhkj.framework.enums.ResultEnum;

/**
 * @Auther: zhangy
 * @Date: 2018/10/16 17:09
 * @Description: API接口调用反馈信息的封装
 */

public class ResultVOUtil {
    //调用成功返回信息和object对象
    public static ResultVO success(Object object){
        ResultVO resultVO = new ResultVO();
        resultVO.setCode(ResultEnum.SUCCESS.getCode());
        resultVO.setMsg(ResultEnum.SUCCESS.getMessage());
        resultVO.setData(object);
        return resultVO;
    }
    //返回调用成功信息
    public static ResultVO success(){
        ResultVO resultVO = new ResultVO();
        resultVO.setCode(ResultEnum.SUCCESS.getCode());
        resultVO.setMsg(ResultEnum.SUCCESS.getMessage());
        return resultVO;
    }
    //调用失败信息
    public static ResultVO error(Integer code,String msg){
        ResultVO resultVO = new ResultVO();
        resultVO.setCode(code);
        resultVO.setMsg(msg);
        return resultVO;
    }

}
